import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    redirect: '/home/index',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'index',
        name: 'Index',
        component: () => import('../views/index/index')
      },
      {
        path: 'company',
        name: 'Company',
        component: () => import('../views/company/index')
      },
      {
        path: 'employee',
        name: 'Employee',
        component: () => import('../views/employee/index')
      },
      {
        path: 'userCenter',
        name: 'UserCenter',
        component: () => import('../views/person/UserCenter')
      },
      {
        path: 'companyInfo',
        name: 'CompanyInfo',
        component: () => import('../views/company/companyInfo')
      },
      {
        path: 'employeeInfo',
        name: 'EmployeeInfo',
        component: () => import('../views/employee/employeeInfo')
      }
    ]
  },
  {
    path: '/',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/loginCompany',
    name: 'LoginCompany',
    component: () => import('../views/LoginCompany')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register')
  },
  {
    path: '/registerCompany',
    name: 'RegisterCompany',
    component: () => import('../views/RegisterCompany')
  },
  {
    path: '/companyHome',
    name: 'CompanyHome',
    component: () => import('../views/CompanyHome'),
    children: [
      {
        path: 'employeeManager',
        name: 'EmployeeManager',
        component: () => import('../views/companyManager/EmployeeManager/index')
      },
      {
        path: 'managerCenter',
        name: 'ManagerCenter',
        component: () => import('../views/companyManager/ManageCenter/index')
      },
      {
        path: 'recruitUser',
        name: 'RecruitUser',
        component: () => import('../views/companyManager/RecruitUser/index')
      }
    ]
  }
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
